#!/bin/bash

name=$(cat name 2>/dev/null)  # 读取name文件，若不存在则忽略错误
while [ "$name" != "cosmos" ]; do
	    dialog --inputbox "Please input username" 10 30 2> name  # 用户输入存入文件 name
	        name=$(cat name)  # 读取 name 文件的内容
	done

	dialog --msgbox "Welcome to Student Info System" 10 20

	while true; do
		    dialog --menu "Choose your operation:" 10 40 4 \
			            1 "Add Student info" \
				            2 "Delete Student info" \
					            3 "Modify Student info" \
						            4 "Exit" 2> menu.txt

		        menu=$(cat menu.txt)  # 读取 menu.txt 内容

			    dialog --msgbox "Your choice is $menu" 10 20

			        if [ "$menu" -eq 4 ]; then
					        exit 0
						    fi
					    done

